<%@ Page Language="C#" MasterPageFile="~/MasterPageMcSigAdmin.master" AutoEventWireup="true" CodeFile="PerfilesListado.aspx.cs" Inherits="PerfilesListado" Title="Untitled Page" %>

<%@ Register Assembly="FUA" Namespace="Subgurim.Controles" TagPrefix="cc2" %>

<%@ Register Assembly="UsrControls" Namespace="UsrControls" TagPrefix="cc1" %>
<%@ Register Assembly="Anthem" Namespace="Anthem" TagPrefix="anthem" %>
<%@ Register assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView.Export" tagprefix="dxwgv" %>    
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h1 class="membresia">Perfiles</h1>
    
                <anthem:label id="lblMensaje" runat="server" autoupdateaftercallback="True" updateaftercallback="True"></anthem:label>
                <anthem:textbox id="txtidUsuario" runat="server" autoupdateaftercallback="True" visible="False">8</anthem:textbox>
            
                <asp:Label ID="lblInstruccion" runat="server" CssClass="instruccion" Text="Para actualizar informacion de un Perfil seleccione un registro en la primera columna y pulse el boton ACTUALIZAR, para borrar informacion seleccione uno o varios registros y pulse el boton ELIMINAR. Si desea ingresar un Perfil pulse el boton AGREGAR."></asp:Label>
        
                <cc1:wccacciones id="WccAcciones1" runat="server" CssClass="toolbar" addcausesvalidation="False" addenablecallback="False"
                    archivevisible="False" auditvisible="False" declinevisible="False" deleteenablecallback="True"
                    deleteprecallbackfunction="delete_PreCallBack" onadd_onclick="WccAcciones1_Add_OnClick"
                    ondelete_onclick="WccAcciones1_Delete_OnClick" onupdate_onclick="WccAcciones1_Update_OnClick"
                    publishvisible="False" updatecausesvalidation="False" updateenablecallback="False"
                    updateonclickfunction="return confirmEdit();" validatevisible="False"></cc1:wccacciones>
            
                <anthem:panel id="Panel1" runat="server" autoupdateaftercallback="True" width="100%"><dxwgv:ASPxGridView id="gridPerfiles" runat="server" Width="100%" KeyFieldName="PER_ID" CssPostfix="PlasticBlue" CssFilePath="~/App_Themes/Plastic Blue/{0}/styles.css" AutoGenerateColumns="False">
                        <Images ImageFolder="~/App_Themes/Plastic Blue/{0}/">
                            <CollapsedButton Height="10px" Url="~/App_Themes/Plastic Blue/GridView/gvCollapsedButton.png"
                                Width="9px"  />
                            <ExpandedButton Height="9px" Url="~/App_Themes/Plastic Blue/GridView/gvExpandedButton.png"
                                Width="9px"  />
                            <HeaderSortDown Height="11px" Url="~/App_Themes/Plastic Blue/GridView/gvHeaderSortDown.png"
                                Width="11px"  />
                            <HeaderSortUp Height="11px" Url="~/App_Themes/Plastic Blue/GridView/gvHeaderSortUp.png"
                                Width="11px"  />
                        </Images>
                        <Settings ShowFilterRow="True" ShowGroupPanel="True"  />
                        <Styles CssFilePath="~/App_Themes/Plastic Blue/{0}/styles.css" CssPostfix="PlasticBlue">
                            <Header ImageSpacing="10px" SortingImageSpacing="10px">
                            </Header>
                        </Styles>
                        <Columns>
                            <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0" Width="20px">
                                <ClearFilterButton Visible="True">
                                </ClearFilterButton>
                            </dxwgv:GridViewCommandColumn>
                            <dxwgv:GridViewDataTextColumn Caption="Nombre"
                                FieldName="PER_NOMBRE" VisibleIndex="1" Width="30%">
                            </dxwgv:GridViewDataTextColumn>
                            <dxwgv:GridViewDataTextColumn Caption="Descripci&#243;n" FieldName="PER_DESCRIPCION"
                                VisibleIndex="2" Width="30%">
                            </dxwgv:GridViewDataTextColumn>
                            <dxwgv:GridViewDataTextColumn Caption="Estado" FieldName="PER_ESTADO" VisibleIndex="3"
                                Width="10%">
                            </dxwgv:GridViewDataTextColumn>
                        </Columns>
                        <SettingsPager ShowDefaultImages="False">
                            <AllButton Text="Todos">
                            </AllButton>
                            <NextPageButton Text="Siguiente &gt;">
                            </NextPageButton>
                            <PrevPageButton Text="&lt; Anterior">
                            </PrevPageButton>
                        </SettingsPager>
                        <SettingsText GroupPanel="Arrastre aqui las columnas que desea agrupar" Title="Usuarios"  />
                    </dxwgv:ASPxGridView> </anthem:panel>
            
    <script language="javascript" type="text/javascript">
    function OnGridSelectionChanged() {
    var counter = document.getElementById("selCount");
    if(counter != null) 
    setInnerText(counter, ctl00_ContentPlaceHolder1_gridPerfiles.GetSelectedRowCount().toString());
    ctl00_ContentPlaceHolder1_gridPerfiles.GetSelectedFieldValues('FPR_ENTIDAD_TERRITORIAL_COFINANCION', OnGridSelectionComplete);
}
function OnGridSelectionComplete(values) {
    selList.BeginUpdate();
    selList.ClearItems();
    for(var i = 0; i < values.length; i ++) {
        selList.AddItem(values[i]);
    }
    selList.EndUpdate();
}
function setInnerText(element, text) { 
    if(typeof element.textContent != 'undefined') { 
        element.textContent = text; 
    } 
    else if (typeof element.innerText != 'undefined') { 
        element.innerText = text; 
    } 
    else if (typeof element.removeChild != 'undefined') { 
        while (element.hasChildNodes()) { 
            element.removeChild(element.lastChild); 
        } 
        element.appendChild(document.createTextNode(text)); 
    } 
}

function confirmEdit()
{
var counter = ctl00_ContentPlaceHolder1_gridPerfiles.GetSelectedRowCount();

if (counter > 1)
    {
    counter = 0;
        alert("Debe seleccionar un solo registro");
        return(false);
    }
    else if (counter == 1)
    {
    counter = 0;
        return(true);
    }
    else if (counter == 0)
    {
    counter = 0;
    alert("Debe seleccionar al  menos un registro");
        return(false);
    }
}
function delete_PreCallBack(button) 
{
var counter = ctl00_ContentPlaceHolder1_gridPerfiles.GetSelectedRowCount();

if (counter > 0)
    {
        return confirm ('Esta seguro de eliminar los registros seleccionados?')
    }
  alert("Debe seleccionar por lo menos un registro");
    return(false);
  
}

function confirmDelete () 
{ 
		var frm;
		
		if (arguments.length > 0)
		{
			frm = arguments[0];
		}
		else
		{
			frm =document.forms[0];
		}



    // loop through all elements
    for (i=0; i<frm.length; i++) 
    {
        // Look for our checkboxes only
        if (frm.elements[i].name.indexOf("chkId") !=-1) 
        {
            // If any are checked then confirm alert, otherwise nothing happens
            if(frm.elements[i].checked) 
            {
                return confirm ('Esta seguro de eliminar los registros seleccionados?')
            }
        }
    }
    alert("Debe seleccionar por lo menos un registro");
    return(false);
}
    </script>
</asp:Content>

